package com.ccl.iot.bean;

/**
 * @description：
 * @author： HD
 * @time：2017/5/9
 */

public class ArmPartitionInfoBean {


    /**
     * 位置起始位
     */
    private int mAddressStart;
    /**
     * 分区状态
     */
    private byte mState;
    /**
     * 布防类型
     */
    private byte mType;
    /**
     * 布防参数：密码型     mArmParamPwd[0]：Length  其他为密码
     */
    private byte[] mArmParamPwd = new byte[4];

    private byte[] mdata = new byte[6];

    private int mIndex;



    public ArmPartitionInfoBean(int addressStart, int state, int type, int pwdLength, int pwd) {
        mAddressStart = addressStart;
        mState = (byte) state;
        mType = (byte) type;
        mArmParamPwd[0] = (byte) pwdLength;
        mArmParamPwd[1] = (byte) ((pwd >> 16) & 0xFF);
        mArmParamPwd[2] = (byte) ((pwd >> 8) & 0xFF);
        mArmParamPwd[3] = (byte) (pwd & 0xFF);
    }

    public ArmPartitionInfoBean(int addressStart, byte[] data, int index) {
        init(addressStart, data, index);
    }

    public void init(int addressStart, byte[] data, int index) {
        mdata = data;
        mAddressStart = addressStart;
        mState = data[0];
        mType = data[1];
        mArmParamPwd[0] = data[2];
        mArmParamPwd[1] = data[3];
        mArmParamPwd[2] = data[4];
        mArmParamPwd[3] = data[5];
        mIndex = index;
    }

    public int getAddressStart() {
        return mAddressStart;
    }

    public void setAddressStart(int addressStart) {
        mAddressStart = addressStart;
    }

    public byte getState() {
        return mState;
    }

    public void setState(byte state) {
        mState = state;
    }

    public byte getType() {
        return mType;
    }

    public void setType(byte type) {
        mType = type;
    }

    public byte[] getArmParamPwd() {
        return mArmParamPwd;
    }

    public void setArmParamPwd(byte pwdLength, int pwd) {
        mArmParamPwd[0] = pwdLength;
        mArmParamPwd[1] = (byte) ((pwd >> 16) & 0xFF);
        mArmParamPwd[2] = (byte) ((pwd >> 8) & 0xFF);
        mArmParamPwd[3] = (byte) (pwd & 0xFF);
    }

    public byte[] getData(){
        return mdata;
    }

    public int getIndex() {
        return mIndex;
    }
}
